//
//  ViewController.m
//  CollectionFlag
//
//  Created by student on 16/3/9.
//  Copyright © 2016年 NIIT. All rights reserved.
//

#import "ViewController.h"
#import "FlagCollectionViewController.h"

@interface ViewController ()<FlagCollectionViewControllerDelegate>

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



- (void)changeFlag:(FlagModel *)flag
{
    self.countryNameLabel.text = flag.name;
    self.countryImage.image = [UIImage imageNamed:flag.imageName];
}

// 3. 告诉下一个页面你是他的代理

// 1) 如果是沿着连线跳转的 prepareForSegue中设置
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    FlagCollectionViewController *destVC =  segue.destinationViewController;
    destVC.delegate = self;
}
@end
